<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!doctype html>
<html>
<head>
<style type="text/css">
li {
	list-style: none;
}
</style>
</head>

<!-- 隐藏域数据 -->
<input type="hidden" id="busiId" name="busiId" value="${busiId}"/>
<input type="hidden"  id="queryCreditApplyId" name="queryCreditApplyId"  value="${queryCreditApplyId}"/>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;贷后业务>客户申请结清表</span>
		</div>
		<div class="buttonfixed">
			<button type="button" class="btn dpbtn_blue" onclick="save();">保存提交</button>
		</div>
		<div class="ibox-content ibox-con">
			<form class="form-horizontal" id="commentForm">
				<%@include file="/jsp/comm_yw_info_include.jsp"%>
				<%@include file="/jsp/kehujieqingContent.jsp"%>	
				<div class="business-man">结清信息</div>
				<div class="business-padding">
					<table cellpadding="0" cellspacing="0" border="0"
						class="buyinfor-table">
						<tr>
							<td align="right"><label class="control-label np">违约金：</label>
							</td>
							<td><input class="form-control" placeholder="违约金(必填)"
								required="required" type="number" id="amountPenalty" value="0"
								name="amountPenalty" aria-required="true" /></td>
							<td align="right"><label class="control-label np">结清类型：</label>
							</td>
							<td class="td-width"><select id="typeSettle"
								name="typeSettle" class="select-control">

							</select></td>
						</tr>
					</table>
				</div>

				<div class="business-manwife">经办信息</div>
				<div class="padding-nono">
					<table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
						<tr>
							<td align="right"><label class="control-label np">当前连续逾期次数：</label></td>
							<td><input class="form-control" type="text" id="creatorName" name="overdueCountContinuous" readonly="overdueCountContinuous" value="${overdueCountContinuous}" /></td>
							<td align="right"><label class="control-label np">累计逾期次数：</label></td>
							<td><input id="overdueCountTotal" name="overdueCountTotal" placeholder="经办时间(必填)" class="form-control" readonly="readonly" value="${overdueCountTotal}"/></td>
						</tr>
						<tr>
							<td align="right"><label class="control-label np">经办人：</label></td>
							<td><input class="form-control" type="text" id="creatorName" name="creatorName" readonly="readonly" value="${current_user_key.uname}" /></td>
							<td align="right"><label class="control-label np">经办时间：</label></td>
							<td><input id="created" name="created" placeholder="经办时间(必填)" class="form-control" readonly="readonly"/></td>
						</tr>
					</table>

				</div>
			</form>
		</div>

	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>

	<!-- layerDate plugin javascript -->
	<script type="text/javascript"
		src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>

	<!-- custom js -->
	<%@include
		file="/js/common-dpqc/dpqc-validate/comm_validate_include.jsp"%>
	<script type="text/javascript" src="${basePath}/js/commonvalidate.js"
		charset="utf-8"></script>
	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	    $(function(){ 
	        $("#commentForm").validate({
	        	 rules: {
	        		 amountPenalty:{
	                   		allMoney: true,
	                 	},
	                },
	                messages: {
	                	amountPenalty:{
	                		allMoney: "金额错误",
	                 },
	             },
	            //重写showErrors
	            showErrors: function (errorMap, errorList) {
	                
	                $.each(errorList, function (i, v) {
	                    layer.tips(v.message, v.element, { time: 1500 });
	                    return false;
	                });  
	            },
	            /* 失去焦点时验证 */
	            onfocusout: function(element) { $(element).valid(); },
	            /*  键盘抬起不验证 */
	            onkeyup:false,
	        });
	        
	        var date = new Date();
		    document.getElementById("created").value = date.format("yyyy-MM-dd h:m:s");
		    
		    getSettlementDic();
	 	});
	    
	    
    	var getSettlementDic=function()
    	{
    		$.dpAjax({
		    	url:'${basePath}/DataDictionaryController/getEnableList',
	 			data:{
	 				"parentValue":"SettleType"
	 			},
	 			success: function(datas)
	 			{
	 				  if(datas.flag == "100100")
					  {
	 					  var result = datas.result.rows;
	 					  var programme_sel=[];
	 				      for(var i=0;i<result.length;i++){
	 				          var programme = result[i];
	 				          programme_sel.push('<option value="'+programme.value+'">'+programme.name+'</option>')
	 				      }
	 				       $("#typeSettle").html(programme_sel.join(' '));
						  return;
					  }
					  layer.msg(datas.message, {icon: 2});
	              }
		   });
    	}
		var save = function(){
			var validstatus = $("#commentForm").valid();
   	    	if(validstatus)
   	    	{
				var data={};
				data.creator=$("#creatorName").val();
				data.creator="${current_user_key.id}";
				data.jbTime=$("#created").val();
				data.amountPenalty=$("#amountPenalty").val();
				data.typeSettle=$('#typeSettle option:selected').val();
				data.busiId= '${busiId}';
				data.cusId = '${cusId}';
				layer.confirm('您确认要保存提交结清信息吗？操作人：<span style="color:#BD1723;">${current_user_key.uname}</span>', {
		  			  btn: ['确定','取消'] //按钮
				},function(){
					layer.closeAll();
					$.dpAjax({
			    		url:'${basePath}/DhSettleController/save',
			    		data:data,
		   				success: function(datas){
			    			  if(datas.flag == "100100")
							  {
			    				  layer.msg('执行成功！', {icon: 6});
								  return;
							  }
							  if(datas.flag == "100200")
			                  {
								  $.fn.showDatas({"datas":datas});
			                	  return;
			                  }
		                }
			    	});
				});	
   	    	}	
		} 
    </script>
</body>
</html>
